﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace UMLDesigner
{
    class AggregationView : RelationView
    {
        public AggregationView()
        {
            endSymbolSize = 16;

            finalPolygon = new Point[] {
                new Point(0,0),
                new Point(endSymbolSize/2, endSymbolSize/2),
                new Point(0, endSymbolSize),
                new Point(-endSymbolSize/2, endSymbolSize/2)
            };
            relationData.SetName("name");
            relationData.SetCardinalityIni("0...*");
            relationData.SetCardinalityEnd("1");
            relationData.SetAttrNameIni("attr2");
            relationData.SetAttrNameEnd("attr1");
            relationData.SetVisibilityEndAttribute(VisibilityType.PRIVATE);
            relationData.SetVisibilityIniAttribute(VisibilityType.PRIVATE);

            relationData.SetRelationType(RelationData.RelationType.Aggegation);
        }

        protected override void PaintEndSymbol(Graphics g, Point coordFinal, float rotacion)
        {
            g.TranslateTransform(coordFinal.X, coordFinal.Y);
            g.RotateTransform(rotacion);
            g.DrawPolygon(myPen, finalPolygon);
            g.ResetTransform();
        }

        public override RelationView CreateObject()
        {
            return new AggregationView();
        }
    }
}
